#ifndef __DUNE_EQUATION_MHD_HH__
#define __DUNE_EQUATION_MHD_HH__
#include "equation-base.hh"
#include <dune/common/parametertreeparser.hh>

namespace Dune {
  namespace Equation {
    class MHDDecorate : public EquationBase {
    public:
      virtual void get_equation_flux(int whichdim, double* fequ, double* var)=0;
      virtual double local_max_eigenvalue(double* var)=0;
      virtual void set_equ_paras(Dune::ParameterTree& ptree)=0;
      virtual double get_thermal_pressure(double* var)=0;
      void get_1d_fx(double* fequ, double* var);
      void get_2d_fx(double* fequ, double* var);
      void get_2d_fy(double* fequ, double* var);
      void get_3d_fz(double* fequ, double* var);
    };

    template<int dim>
    class MHD_: public MHDDecorate{};
    template<int dim>
    using MHD = MHD_<dim>;

    template<>
    class MHD_<1> : public MHDDecorate {
    public:
      static constexpr int dim = 1;
      static constexpr int nvar = 7;
      MHD_<1>(Dune::ParameterTree& ptree);
      virtual ~MHD_<1>();  
      void get_equation_flux(int whichdim, double* fequ, double* var);
      double local_max_eigenvalue(double* var);
      void set_equ_paras(Dune::ParameterTree& ptree);
      double get_thermal_pressure(double* var);
    };

    template<>
    class MHD_<2> : public MHDDecorate {
    public:
      static constexpr int dim = 2;
      static constexpr int nvar = 8;
      MHD_<2>(Dune::ParameterTree& ptree);
      virtual ~MHD_<2>();  
      void get_equation_flux(int whichdim, double* fequ, double* var);
      double local_max_eigenvalue(double* var);
      void set_equ_paras(Dune::ParameterTree& ptree);
      double get_thermal_pressure(double* var);
    };

    template<>
    class MHD_<3> : public MHDDecorate {
    public:
      static constexpr int dim = 3;
      static constexpr int nvar = 8;
      MHD_<3>(Dune::ParameterTree& ptree);
      virtual ~MHD_<3>();  
      void get_equation_flux(int whichdim, double* fequ, double* var);
      double local_max_eigenvalue(double* var);
      void set_equ_paras(Dune::ParameterTree& ptree);
      double get_thermal_pressure(double* var);
    };
  } // Equation
} // MHD
#endif // __DUNE_EQUATION_MHD_HH__
